package com.ahclic.interceptor;

import javax.servlet.http.*;

import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class CommonInterceptor extends HandlerInterceptorAdapter {
	@Override    
    public boolean preHandle(HttpServletRequest request,    
            HttpServletResponse response, Object handler) throws Exception {
		String username =  (String)request.getSession().getAttribute("username"); 
		if(username==null) {
			request.getRequestDispatcher("login.jsp").forward(request, response);
			return false;
		}else {
			return true;	
		}
	   
	}
}
